package 第二章实用类作业;

import java.util.Scanner;

public class StrExitCount {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("请输入一串字符串");
        String str=input.next();
        System.out.println("请输入你要查找的字符");
        String seek=input.next();
        String[] strs=new String[str.length()];
        int k=seek.length();
        int count=0;
        for (int i = 0; i <strs.length-k+1; i+=2) {
            strs[i]=str.substring(i,i+k);
            if (strs[i].equals(seek)){
                count++;
            }
        }
        System.out.println("seek"+"\t"+str+"中"+seek+"出现的次数是:"+count+"次");
    }
}
